﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using TripsLogic.controller;

namespace TripsLogic.master.uc
{
    public partial class ucHeader : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                loadLang();
                loadSlider();
                loadMenu();
            }
        }

        private void loadMenu()
        {
            litMenu.Text = "<ul id='menu'>";
            DataTable dt = MenuController.getMenus("2", "");
            if (dt != null && dt.Rows.Count > 0)
            {

            }
            //<ul id="menu">
            //    <li id="nav1" class="active"><a href="index.html">about us </a></li>
            //    <li id="nav2"><a href="index-1.html">flights info</a></li>
            //    <li id="nav3"><a href="index-2.html">our aircraft</a>
            //        <ul class="submenu1">
            //            <li><a href="index-2.html">our history  </a></li>
            //            <li><a href="index-2.html">our standards</a>
            //                <ul class="submenu2">
            //                    <li><a href="index-2.html">our history</a></li>
            //                    <li><a href="index-2.html">our standards</a></li>
            //                    <li><a href="index-2.html">teamwork</a></li>
            //                </ul>
            //            </li>
            //            <li><a href="index-2.html">teamwork</a></li>
            //        </ul>
            //    </li>
            //    <li id="nav4"><a href="index-3.html">safety</a></li>
            //    <li id="nav5"><a href="index-4.html">charters</a></li>
            //    <li id="nav6"><a href="index-5.html">contact us</a></li>
            //</ul>
        }

        private void loadSlider()
        {
            litSlider.Text = "<ul class='pagination'>";
            DataTable dt = SliderController.getSliders("1");

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["Id"].ToString().Equals(dt.Rows[0]["Id"].ToString()))
                    {
                        litSlider.Text += "<li class='current'><a href='images/slide/" + dr["DisplayImage"].ToString() + "'></a></li>";
                    }
                    else
                    {
                        litSlider.Text += "<li><a href='images/slide/" + dr["DisplayImage"].ToString() + "'></a></li>";
                    }
                }
            }
            litSlider.Text += "</ul>";
        }

        private void loadLang()
        {
            
        }
    }
}